function loadBlocks(groupId) {
	if (!$('ul#icd10Group li#group_' + groupId).hasClass('active')) {
		$('ul#icd10Group li').removeClass('active');
		$('ul#icd10Group li#group_' + groupId).addClass('active');
		$.ajax ({
			type: 	 "GET",
			url:	 "../Icd10/getBlocksAjax?set_ajax_view",
			data:	 "groupId=" + groupId,
			beforeSend: function() {
			 $('select#icd10ChapterSelection').attr('disabled',true);
			
			},
			success: function(data) {
				$('#icdBlock').html(data);
				$('#icdItem').html('');
				$('select#icd10ChapterSelection').attr('disabled',false);
			}
		});
	}
	
}

function loadItems(blockCode, blockId) {
	if (!$('ul#icd10Block li#block_' + blockId).hasClass('active')) {
		$('ul#icd10Block li').removeClass('active');
		$('ul#icd10Block li#block_' + blockId).addClass('active');
		$('#selectedCode').val(blockCode);
		$('#selectedName').val($('ul#icd10Block li#block_' + blockId + " span.name").text());
		var msg = _("Selected: {0}",$('ul#icd10Block li#block_' + blockId).text());
		$('#result i').html(msg);
		$.ajax ({
			type: 	 "GET",
			url:	 "../Icd10/getItemsAjax?set_ajax_view",
			data:	 "code=" + blockCode,
			beforeSend: function() {
				 $('select#icd10ChapterSelection').attr('disabled',true);
				
			},
			success: function(data) {
				$('#icdItem').html(data);
				$('select#icd10ChapterSelection').attr('disabled',false);
			}
		});
	}
}

function getItem(blockCode, blockId) {
	$('ul#icd10Item li').removeClass('active');
	$('ul#icd10Item li#item_' + blockId).addClass('active');
	$('#selectedCode').val(blockCode);
	$('#selectedName').val($('ul#icd10Item li#item_' + blockId + " span.name").text());
	var msg = _("Selected: {0}",$('ul#icd10Item li#item_' + blockId).text());
	$('#result i').html(msg);	
}

function getNormal() {
	$('ul#icd10Group li').removeClass('active');
	$('ul#icd10Group li#group_normal').addClass('active');
	$('#icdBlock').html('');
	$('#icdItem').html('');
	$('#selectedCode').val(_('BT'));
	$('#selectedName').val(_('Normal'));
	var msg = _("Selected: Normal");
	$('#result i').html(msg);	
}

function showIcd10List(curIcd10CodeId1, curIcd10NameId1){
	var buttons = {};
	buttons[_('Cancel')] = function() {
		$(this).dialog('close');		
	};
	buttons[_('Select')] = function() {
		$('#' + curIcd10CodeId1).val($('#selectedCode').val());
		$('#' + curIcd10NameId1).val($('#selectedName').val());
		$(this).dialog('close'); 			
	};

	generalDialog('divIcd10List',null,null,null,{
		autoOpen: true,			
		bgiframe: true,
		resizable: true,		
		width: 920,
		height: 550,
		modal: true,
		dialogClass: 'custom-dialog',
		buttons: buttons
	},_('Cancel'));


}
function loadIcd10Chapter() {
	var selectedChapertId = $('select#icd10ChapterSelection').val();
    if (selectedChapertId != null && $.trim(selectedChapertId) != '' && selectedChapertId > 0) {
    	$.ajax ({
			type: 	 "GET",
			url:	 "../Icd10/GetGroupsByChapterIdAjax?set_ajax_view",
			data:	 "icd10ChapterId=" + selectedChapertId,			
			success: function(data) {
    			$('#icdGroup').html(data)	
	    		$('#icdBlock').html('');
				$('#icdItem').html('');
			}
		});
            
    } else {
    	$('#icdGroup').html('')	
		$('#icdBlock').html('');
		$('#icdItem').html('');    	
    }
    
}
